cmake_minimum_required(VERSION 3.20)

# 查找 glib-2.0 包
spark_find_library(glib glib-2.0)

option(USE_GTK4 "使用 gtk4 构建 gtk 应用" OFF)
if(USE_GTK4)
    spark_find_library(gtk gtk4)
else()
    spark_find_library(gtk gtk+-3.0)
endif(USE_GTK4)

# 构建 gtkutils 基于指定目录
spark_add_library_path(gtkutils gtkutils)
target_link_gtk(gtkutils)
# 将头文件目录提供出去
target_include_directories(gtkutils PUBLIC gtkutils)


# 构建 baseutils 基于指定目录
spark_add_library_path(baseutils baseutils baseutils/logs)
target_link_glib(baseutils)
# 将头文件目录提供出去
target_include_directories(baseutils PUBLIC baseutils)


# 构建 cjsonutils 基于指定目录
spark_add_library_path(cjsonutils cjsonutils cjsonutils/cjson)
target_include_directories(cjsonutils PUBLIC cjsonutils cjsonutils/cjson)


# 构建 linuxutils 基于指定目录
spark_add_library_path(linuxutils linuxutils linuxutils/etc linuxutils/etc/network linuxutils/proc)
target_link_baseutils(linuxutils)
target_include_directories(linuxutils PUBLIC linuxutils)


# 构建 other 基于指定目录
spark_add_library_path(other other/gateway)
target_link_linuxutils(other)
target_include_directories(other PUBLIC other)
